package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution1120 {
    public double maximumAverageSubtree(TreeNode root) {
        return TreeUtils.maximumAverageSubtree(root);
    }
}

public class leetcode1120 {
    public static void main(String[] args) {
        Solution1120 solution1120 = new Solution1120();
        Integer[] nums = {5, 6, 1};
        Integer[] nums1 = {2, null, 1};
//        test1120(solution1120, nums);
        test1120(solution1120, nums1);
    }

    private static void test1120(Solution1120 solution1120, Integer[] nums) {
        TreeNode root = TreeUtils.generateLeetcodeTree(nums);
        System.out.println(solution1120.maximumAverageSubtree(root));
    }
}
